home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekkan Dennou Club 147
/
Gekkan Dennou Club - 2000.8 Vol. 147 (Japan).7z
/
Gekkan Dennou Club - 2000.8 Vol. 147 (Japan) (Track 1).bin
/
docs
/
ippon
/
ver
/
006
/
ippon006.lzh
/
maketbl.c
< prev
next >
Wrap
C/C++ Source or Header
|
2000-07-07
|
1KB
|
72 lines
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define SPEED_MAX 32
double speed[SPEED_MAX] =
{0.50, 0.60, 0.70, 0.80, 0.90,
1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90,
2.00, 2.10, 2.20, 2.30, 2.40, 2.50, 2.60, 2.70, 2.80, 2.90,
3.00, 3.10, 3.20,
4.00, 5.00, 6.00, 7.00};
typedef struct {
signed int x, y;
} VECTOR;
VECTOR xytable[SPEED_MAX][256];
void usage (void)
{
printf (
"IPPON.X 用テーブルを作成する maketbl.x ver0.01\n"
" programmed by Mitsuky <FreeSoftware>\n"
"以下のテーブルを作成します\n"
" TBL/XYTABLE.DAT : sin,cos テーブル\n"
"角度関係のは全て1周=256段階で、右向きが0、下向きが64となっております\n"
);
}
int maketable (void)
{
int i, j;
FILE *fp;
printf ("データテーブルを作成します。\n");
for (i = 0; i < SPEED_MAX; i++) {
for (j = 0; j < 256; j++) {
xytable[i][j].x = (signed int) (cos (2.0 * M_PI * (long) j / 256.0) * 65536.0 * speed[i]);
xytable[i][j].y = (signed int) (sin (2.0 * M_PI * (long) j / 256.0) * 65536.0 * speed[i]);
}
}
fp = fopen ("TBL/XYTABLE.DAT", "wb");
if (fp == NULL) {
printf ("TBL/XYTABLE.DAT が書き込めません\n");
exit (-1);
}
fwrite (xytable, 256 * SPEED_MAX, sizeof (VECTOR), fp);
fclose (fp);
printf ("\n終了しました。\n");
return (0);
}
int main (int argc, char *argv[])
{
if (argc != 1) {
usage ();
return (-1);
}
maketable ();
return (0);
}